package com.jishi.gouwuche.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Result<T>{
    private int status;
    private String msg;
    private T data;
    public Result(String msg,int status){
        this.msg=msg;
        this.status=status;
    }
    public Result(String msg,int status,T data){
        this.msg=msg;
        this.status=status;
        this.data=data;
    }

    public static <T> Result<T> success(T data) {
        return new Result<>("ok", 200, data);
    }

    public static <T> Result<T> error(String msg) {
        return new Result<>(msg,400, null);
    }
}
